using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace DTO
{
	/// <summary> 
	///Author: nnamthach@gmail.com 
	/// <summary>
	
    public class GIAODICHInfo
    {
		#region Local Variable
		public enum Field
		{
			SOCT,
			LOAICT,
			NGAYCT,
			MAKH,
			TIENHANG,
			VAT,
			PHIVC,
			CHIETKHAU,
			TONGTIEN,
			TIENMAT,
			CONGNO,
			THUNGAY,
			LOAITIEN,
			NameKH,
			DIACHIKH,
			DIENTHOAI,
			NOIDUNG,
			TINHTRANG,
			INHD,
			TAIKHOAN,
			NGANHANG,
			TINH_TP,
			CREATEBY,
			MODIFIEDBY,
			CREATEDATE,
			MODIFIEDDATE
		}
		private String _SOCT;
		private String _LOAICT;
		private DateTime _NGAYCT;
		private String _MAKH;
		private Double _TIENHANG;
		private Double _VAT;
		private Double _PHIVC;
		private Double _CHIETKHAU;
		private Double _TONGTIEN;
		private Double _TIENMAT;
		private Double _CONGNO;
		private Double _THUNGAY;
		private String _LOAITIEN;
		private String _NameKH;
		private String _DIACHIKH;
		private String _DIENTHOAI;
		private String _NOIDUNG;
		private String _TINHTRANG;
		private Boolean _INHD;
		private String _TAIKHOAN;
		private String _NGANHANG;
		private String _TINH_TP;
		private String _CREATEBY;
		private String _MODIFIEDBY;
		private DateTime _CREATEDATE;
		private DateTime _MODIFIEDDATE;
		
		public String SOCT{	get{ return _SOCT;} set{_SOCT = value;} }
		public String LOAICT{	get{ return _LOAICT;} set{_LOAICT = value;} }
		public DateTime NGAYCT{	get{ return _NGAYCT;} set{_NGAYCT = value;} }
		public String MAKH{	get{ return _MAKH;} set{_MAKH = value;} }
		public Double TIENHANG{	get{ return _TIENHANG;} set{_TIENHANG = value;} }
		public Double VAT{	get{ return _VAT;} set{_VAT = value;} }
		public Double PHIVC{	get{ return _PHIVC;} set{_PHIVC = value;} }
		public Double CHIETKHAU{	get{ return _CHIETKHAU;} set{_CHIETKHAU = value;} }
		public Double TONGTIEN{	get{ return _TONGTIEN;} set{_TONGTIEN = value;} }
		public Double TIENMAT{	get{ return _TIENMAT;} set{_TIENMAT = value;} }
		public Double CONGNO{	get{ return _CONGNO;} set{_CONGNO = value;} }
		public Double THUNGAY{	get{ return _THUNGAY;} set{_THUNGAY = value;} }
		public String LOAITIEN{	get{ return _LOAITIEN;} set{_LOAITIEN = value;} }
		public String NameKH{	get{ return _NameKH;} set{_NameKH = value;} }
		public String DIACHIKH{	get{ return _DIACHIKH;} set{_DIACHIKH = value;} }
		public String DIENTHOAI{	get{ return _DIENTHOAI;} set{_DIENTHOAI = value;} }
		public String NOIDUNG{	get{ return _NOIDUNG;} set{_NOIDUNG = value;} }
		public String TINHTRANG{	get{ return _TINHTRANG;} set{_TINHTRANG = value;} }
		public Boolean INHD{	get{ return _INHD;} set{_INHD = value;} }
		public String TAIKHOAN{	get{ return _TAIKHOAN;} set{_TAIKHOAN = value;} }
		public String NGANHANG{	get{ return _NGANHANG;} set{_NGANHANG = value;} }
		public String TINH_TP{	get{ return _TINH_TP;} set{_TINH_TP = value;} }
		public String CREATEBY{	get{ return _CREATEBY;} set{_CREATEBY = value;} }
		public String MODIFIEDBY{	get{ return _MODIFIEDBY;} set{_MODIFIEDBY = value;} }
		public DateTime CREATEDATE{	get{ return _CREATEDATE;} set{_CREATEDATE = value;} }
		public DateTime MODIFIEDDATE{	get{ return _MODIFIEDDATE;} set{_MODIFIEDDATE = value;} }
		
        #endregion LocalVariable
        
        #region Constructor
		public GIAODICHInfo()
		{
			_SOCT = "";
			_LOAICT = "";
			_NGAYCT = DateTime.Now;
			_MAKH = "";
			_TIENHANG = 0;
			_VAT = 0;
			_PHIVC = 0;
			_CHIETKHAU = 0;
			_TONGTIEN = 0;
			_TIENMAT = 0;
			_CONGNO = 0;
			_THUNGAY = 0;
			_LOAITIEN = "";
			_NameKH = "";
			_DIACHIKH = "";
			_DIENTHOAI = "";
			_NOIDUNG = "";
			_TINHTRANG = "";
			_INHD = true;
			_TAIKHOAN = "";
			_NGANHANG = "";
			_TINH_TP = "";
			_CREATEBY = "";
			_MODIFIEDBY = "";
			_CREATEDATE = DateTime.Now;
			_MODIFIEDDATE = DateTime.Now;
		}
		public GIAODICHInfo(
		String SOCT,
		String LOAICT,
		DateTime NGAYCT,
		String MAKH,
		Double TIENHANG,
		Double VAT,
		Double PHIVC,
		Double CHIETKHAU,
		Double TONGTIEN,
		Double TIENMAT,
		Double CONGNO,
		Double THUNGAY,
		String LOAITIEN,
		String NameKH,
		String DIACHIKH,
		String DIENTHOAI,
		String NOIDUNG,
		String TINHTRANG,
		Boolean INHD,
		String TAIKHOAN,
		String NGANHANG,
		String TINH_TP,
		String CREATEBY,
		String MODIFIEDBY,
		DateTime CREATEDATE,
		DateTime MODIFIEDDATE
		)
		{
			_SOCT = SOCT;
			_LOAICT = LOAICT;
			_NGAYCT = NGAYCT;
			_MAKH = MAKH;
			_TIENHANG = TIENHANG;
			_VAT = VAT;
			_PHIVC = PHIVC;
			_CHIETKHAU = CHIETKHAU;
			_TONGTIEN = TONGTIEN;
			_TIENMAT = TIENMAT;
			_CONGNO = CONGNO;
			_THUNGAY = THUNGAY;
			_LOAITIEN = LOAITIEN;
			_NameKH = NameKH;
			_DIACHIKH = DIACHIKH;
			_DIENTHOAI = DIENTHOAI;
			_NOIDUNG = NOIDUNG;
			_TINHTRANG = TINHTRANG;
			_INHD = INHD;
			_TAIKHOAN = TAIKHOAN;
			_NGANHANG = NGANHANG;
			_TINH_TP = TINH_TP;
			_CREATEBY = CREATEBY;
			_MODIFIEDBY = MODIFIEDBY;
			_CREATEDATE = CREATEDATE;
			_MODIFIEDDATE = MODIFIEDDATE;
		}
		public GIAODICHInfo(DataRow dr)
		{
			if (dr != null)
			{
				_SOCT = dr[Field.SOCT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCT.ToString()]);
				_LOAICT = dr[Field.LOAICT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOAICT.ToString()]);
				_NGAYCT = dr[Field.NGAYCT.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.NGAYCT.ToString()]);
				_MAKH = dr[Field.MAKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MAKH.ToString()]);
				_TIENHANG = dr[Field.TIENHANG.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TIENHANG.ToString()]);
				_VAT = dr[Field.VAT.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.VAT.ToString()]);
				_PHIVC = dr[Field.PHIVC.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.PHIVC.ToString()]);
				_CHIETKHAU = dr[Field.CHIETKHAU.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.CHIETKHAU.ToString()]);
				_TONGTIEN = dr[Field.TONGTIEN.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TONGTIEN.ToString()]);
				_TIENMAT = dr[Field.TIENMAT.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TIENMAT.ToString()]);
				_CONGNO = dr[Field.CONGNO.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.CONGNO.ToString()]);
				_THUNGAY = dr[Field.THUNGAY.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.THUNGAY.ToString()]);
				_LOAITIEN = dr[Field.LOAITIEN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOAITIEN.ToString()]);
				_NameKH = dr[Field.NameKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NameKH.ToString()]);
				_DIACHIKH = dr[Field.DIACHIKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHIKH.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_NOIDUNG = dr[Field.NOIDUNG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NOIDUNG.ToString()]);
				_TINHTRANG = dr[Field.TINHTRANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINHTRANG.ToString()]);
				_INHD = dr[Field.INHD.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.INHD.ToString()]);
				_TAIKHOAN = dr[Field.TAIKHOAN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TAIKHOAN.ToString()]);
				_NGANHANG = dr[Field.NGANHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NGANHANG.ToString()]);
				_TINH_TP = dr[Field.TINH_TP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINH_TP.ToString()]);
				_CREATEBY = dr[Field.CREATEBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDATE = dr[Field.CREATEDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.CREATEDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.MODIFIEDDATE.ToString()]);
			}
		}
		public GIAODICHInfo(DataRowView dr)
		{
			if (dr != null)
			{
				_SOCT = dr[Field.SOCT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.SOCT.ToString()]);
				_LOAICT = dr[Field.LOAICT.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOAICT.ToString()]);
				_NGAYCT = dr[Field.NGAYCT.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.NGAYCT.ToString()]);
				_MAKH = dr[Field.MAKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MAKH.ToString()]);
				_TIENHANG = dr[Field.TIENHANG.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TIENHANG.ToString()]);
				_VAT = dr[Field.VAT.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.VAT.ToString()]);
				_PHIVC = dr[Field.PHIVC.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.PHIVC.ToString()]);
				_CHIETKHAU = dr[Field.CHIETKHAU.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.CHIETKHAU.ToString()]);
				_TONGTIEN = dr[Field.TONGTIEN.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TONGTIEN.ToString()]);
				_TIENMAT = dr[Field.TIENMAT.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.TIENMAT.ToString()]);
				_CONGNO = dr[Field.CONGNO.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.CONGNO.ToString()]);
				_THUNGAY = dr[Field.THUNGAY.ToString()] == DBNull.Value?0:Convert.ToDouble(dr[Field.THUNGAY.ToString()]);
				_LOAITIEN = dr[Field.LOAITIEN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.LOAITIEN.ToString()]);
				_NameKH = dr[Field.NameKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NameKH.ToString()]);
				_DIACHIKH = dr[Field.DIACHIKH.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIACHIKH.ToString()]);
				_DIENTHOAI = dr[Field.DIENTHOAI.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.DIENTHOAI.ToString()]);
				_NOIDUNG = dr[Field.NOIDUNG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NOIDUNG.ToString()]);
				_TINHTRANG = dr[Field.TINHTRANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINHTRANG.ToString()]);
				_INHD = dr[Field.INHD.ToString()] == DBNull.Value?true:Convert.ToBoolean(dr[Field.INHD.ToString()]);
				_TAIKHOAN = dr[Field.TAIKHOAN.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TAIKHOAN.ToString()]);
				_NGANHANG = dr[Field.NGANHANG.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.NGANHANG.ToString()]);
				_TINH_TP = dr[Field.TINH_TP.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.TINH_TP.ToString()]);
				_CREATEBY = dr[Field.CREATEBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.CREATEBY.ToString()]);
				_MODIFIEDBY = dr[Field.MODIFIEDBY.ToString()] == DBNull.Value?"":Convert.ToString(dr[Field.MODIFIEDBY.ToString()]);
				_CREATEDATE = dr[Field.CREATEDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.CREATEDATE.ToString()]);
				_MODIFIEDDATE = dr[Field.MODIFIEDDATE.ToString()] == DBNull.Value?DateTime.Now:Convert.ToDateTime(dr[Field.MODIFIEDDATE.ToString()]);
			}
		}
		public GIAODICHInfo(GIAODICHInfo objEntr)
		{			
			_SOCT = objEntr.SOCT;			
			_LOAICT = objEntr.LOAICT;			
			_NGAYCT = objEntr.NGAYCT;			
			_MAKH = objEntr.MAKH;			
			_TIENHANG = objEntr.TIENHANG;			
			_VAT = objEntr.VAT;			
			_PHIVC = objEntr.PHIVC;			
			_CHIETKHAU = objEntr.CHIETKHAU;			
			_TONGTIEN = objEntr.TONGTIEN;			
			_TIENMAT = objEntr.TIENMAT;			
			_CONGNO = objEntr.CONGNO;			
			_THUNGAY = objEntr.THUNGAY;			
			_LOAITIEN = objEntr.LOAITIEN;			
			_NameKH = objEntr.NameKH;			
			_DIACHIKH = objEntr.DIACHIKH;			
			_DIENTHOAI = objEntr.DIENTHOAI;			
			_NOIDUNG = objEntr.NOIDUNG;			
			_TINHTRANG = objEntr.TINHTRANG;			
			_INHD = objEntr.INHD;			
			_TAIKHOAN = objEntr.TAIKHOAN;			
			_NGANHANG = objEntr.NGANHANG;			
			_TINH_TP = objEntr.TINH_TP;			
			_CREATEBY = objEntr.CREATEBY;			
			_MODIFIEDBY = objEntr.MODIFIEDBY;			
			_CREATEDATE = objEntr.CREATEDATE;			
			_MODIFIEDDATE = objEntr.MODIFIEDDATE;			
		}
        #endregion Constructor
        
        #region InitTable
		public static DataTable ToDataTable()
		{
			DataTable dt = new DataTable("GIAODICH");
			dt.Columns.AddRange(new DataColumn[] { 
				new DataColumn(Field.SOCT.ToString(), typeof(String)),
				new DataColumn(Field.LOAICT.ToString(), typeof(String)),
				new DataColumn(Field.NGAYCT.ToString(), typeof(DateTime)),
				new DataColumn(Field.MAKH.ToString(), typeof(String)),
				new DataColumn(Field.TIENHANG.ToString(), typeof(Double)),
				new DataColumn(Field.VAT.ToString(), typeof(Double)),
				new DataColumn(Field.PHIVC.ToString(), typeof(Double)),
				new DataColumn(Field.CHIETKHAU.ToString(), typeof(Double)),
				new DataColumn(Field.TONGTIEN.ToString(), typeof(Double)),
				new DataColumn(Field.TIENMAT.ToString(), typeof(Double)),
				new DataColumn(Field.CONGNO.ToString(), typeof(Double)),
				new DataColumn(Field.THUNGAY.ToString(), typeof(Double)),
				new DataColumn(Field.LOAITIEN.ToString(), typeof(String)),
				new DataColumn(Field.NameKH.ToString(), typeof(String)),
				new DataColumn(Field.DIACHIKH.ToString(), typeof(String)),
				new DataColumn(Field.DIENTHOAI.ToString(), typeof(String)),
				new DataColumn(Field.NOIDUNG.ToString(), typeof(String)),
				new DataColumn(Field.TINHTRANG.ToString(), typeof(String)),
				new DataColumn(Field.INHD.ToString(), typeof(Boolean)),
				new DataColumn(Field.TAIKHOAN.ToString(), typeof(String)),
				new DataColumn(Field.NGANHANG.ToString(), typeof(String)),
				new DataColumn(Field.TINH_TP.ToString(), typeof(String)),
				new DataColumn(Field.CREATEBY.ToString(), typeof(String)),
				new DataColumn(Field.MODIFIEDBY.ToString(), typeof(String)),
				new DataColumn(Field.CREATEDATE.ToString(), typeof(DateTime)),
				new DataColumn(Field.MODIFIEDDATE.ToString(), typeof(DateTime))
			});
			return dt;
		}
		public DataRow ToDataRow(DataTable dt)
		{
			DataRow row = dt.NewRow();
			row[Field.SOCT.ToString()] = _SOCT;
			row[Field.LOAICT.ToString()] = _LOAICT;
			row[Field.NGAYCT.ToString()] = _NGAYCT;
			row[Field.MAKH.ToString()] = _MAKH;
			row[Field.TIENHANG.ToString()] = _TIENHANG;
			row[Field.VAT.ToString()] = _VAT;
			row[Field.PHIVC.ToString()] = _PHIVC;
			row[Field.CHIETKHAU.ToString()] = _CHIETKHAU;
			row[Field.TONGTIEN.ToString()] = _TONGTIEN;
			row[Field.TIENMAT.ToString()] = _TIENMAT;
			row[Field.CONGNO.ToString()] = _CONGNO;
			row[Field.THUNGAY.ToString()] = _THUNGAY;
			row[Field.LOAITIEN.ToString()] = _LOAITIEN;
			row[Field.NameKH.ToString()] = _NameKH;
			row[Field.DIACHIKH.ToString()] = _DIACHIKH;
			row[Field.DIENTHOAI.ToString()] = _DIENTHOAI;
			row[Field.NOIDUNG.ToString()] = _NOIDUNG;
			row[Field.TINHTRANG.ToString()] = _TINHTRANG;
			row[Field.INHD.ToString()] = _INHD;
			row[Field.TAIKHOAN.ToString()] = _TAIKHOAN;
			row[Field.NGANHANG.ToString()] = _NGANHANG;
			row[Field.TINH_TP.ToString()] = _TINH_TP;
			row[Field.CREATEBY.ToString()] = _CREATEBY;
			row[Field.MODIFIEDBY.ToString()] = _MODIFIEDBY;
			row[Field.CREATEDATE.ToString()] = _CREATEDATE;
			row[Field.MODIFIEDDATE.ToString()] = _MODIFIEDDATE;
			return row;
		}
        #endregion InitTable
    }
}
